<%@ page language="java" contentType="text/html; charset=UTF8" pageEncoding="UTF8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.bun.ipmon.service.IpMonService" %>
<%@ page import="com.google.appengine.api.memcache.MemcacheService" %>
<%@ page import="com.google.appengine.api.memcache.MemcacheServiceFactory" %>
<%@ page import="com.google.appengine.api.memcache.ErrorHandlers" %>
<%@ page import="com.google.appengine.api.memcache.Expiration" %>
<%@ page import="java.util.logging.Level" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%
	IpMonService ipMonService = new IpMonService();
	MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService();
	syncCache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO));
	
	Calendar cal = Calendar.getInstance();
	cal.add(Calendar.HOUR, +8);
	Date todayDate = cal.getTime();
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	String mailSent2 = (String) syncCache.get("mailSent2");
	if(mailSent2 == null){
		ipMonService.sendMail("Has phone "+sdf.format(todayDate), (String) syncCache.get("detail"));
		syncCache.put("mailSent2",sdf.format(todayDate),Expiration.byDeltaSeconds(60));
	}
	
%>
